package com.ytf.test.seventh;

/**
 * @author: YTF
 * @date: 2024/9/27 12:29
 * @version: 1.0
 * @description: 代理
 */
public class SpaceShipControls {
    void up(int velocity){
        System.out.println("SpaceShipControls.up(int velocity)");
    }
    void down(int velocity){
        System.out.println("SpaceShipControls.down(int velocity)");
    }
    void left(int velocity){
        System.out.println("SpaceShipControls.left(int velocity)");
    }
    void right(int velocity){
        System.out.println("SpaceShipControls.right(int velocity)");
    }
    void forward(int velocity){
        System.out.println("SpaceShipControls.forward(int velocity)");
    }
    void back(int velocity){
        System.out.println("SpaceShipControls.back(int velocity)");
    }
    void turboBoost(int velocity){
        System.out.println("SpaceShipControls.turboBoost(int velocity)");
    }
}
class SpaceShip extends SpaceShipControls{
    private String name;

    public SpaceShip() {
    }

    public SpaceShip(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "SpaceShip{" +
                "name='" + name + '\'' +
                '}';
    }

    public static void main(String[] args) {
        SpaceShip spaceShip = new SpaceShip("NSEA Protector");
        spaceShip.forward(100);
    }
}
class SpaceShipDelegation{
    private String name;
    private SpaceShipControls spaceShipControls = new SpaceShipControls();

    public SpaceShipDelegation() {
    }

    public SpaceShipDelegation(String name) {
        this.name = name;
    }
    public void up(int velocity){
        System.out.println("SpaceShipDelegation.up(int velocity)");
        spaceShipControls.up(velocity);
    }
    public void down(int velocity){
        System.out.println("SpaceShipDelegation.down(int velocity)");
        spaceShipControls.down(velocity);
    }
    public void left(int velocity){
        System.out.println("SpaceShipDelegation.left(int velocity)");
        spaceShipControls.left(velocity);
    }
    public void right(int velocity){
        System.out.println("SpaceShipDelegation.right(int velocity)");
        spaceShipControls.right(velocity);
    }
    public void forward(int velocity){
        System.out.println("SpaceShipDelegation.forward(int velocity)");
        spaceShipControls.forward(velocity);
    }
    public void back(int velocity){
        System.out.println("SpaceShipDelegation.back(int velocity)");
        spaceShipControls.back(velocity);
    }
    public void turboBoost(int velocity){
        System.out.println("SpaceShipDelegation.turboBoost(int velocity)");
        spaceShipControls.turboBoost(velocity);
    }
    public static void main(String[] args) {
        SpaceShipDelegation spaceShip = new SpaceShipDelegation("NSEA Protector");
        spaceShip.forward(100);
    }
}
